package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zgf extends zgd {
   zgf(ArrayList var1, zga var2, float var3, float var4, float var5, double[] var6, boolean var7) throws Exception {
      super(var1, var2, var3, var4, var5, var6, var7);
   }

   protected void a(ArrayList var1, double[] var2) throws Exception {
      while(var1.size() > 0) {
         com.aspose.cells.b.a.a.ze.a(this.i, (Object)(new zamd(var1, this.i.size() == 0, this.o, this.c - this.m.a() * a / 72.0F, this.d, this.h, this.m, this.n, var2)));
      }

   }

   protected float c(double var1, float var3) {
      return zgd.a(var1, var3);
   }

   void a(com.aspose.cells.a.d.zb var1) throws Exception {
      float var6 = 0.0F;

      label104:
      for(int var7 = 0; var7 < this.i.size(); ++var7) {
         zamb var8 = (zamb)this.i.get(var7);
         int var9 = 0;
         float var10 = var8.e;
         Iterator var11 = var8.a.iterator();

         while(true) {
            Color var4;
            zbch var12;
            int var13;
            float var14;
            String var15;
            do {
               do {
                  if (!var11.hasNext()) {
                     continue label104;
                  }

                  var12 = (zbch)var11.next();
               } while(var12 == null);

               if (var12.a.d == 1) {
                  var6 = (this.c - 2.0F) / a * 72.0F - this.e;
                  if (var6 < 0.0F) {
                     var6 = 0.0F;
                  }

                  if (this.e < this.c / a * 72.0F) {
                     this.e = this.c / a * 72.0F;
                  }
               }

               var4 = Color.a(255, (Color)var12.a.b.getColor());
               var13 = (var12.a.b.isBold() ? 1 : 0) | (var12.a.b.isItalic() ? 2 : 0) | (var12.a.b.isStrikeout() ? 8 : 0) | (var12.a.b.getUnderline() != 0 ? 4 : 0);
               var12.a.a = var12.a.a.replace('\r', ' ');
               var14 = 0.0F;
               var15 = var12.a.a;
            } while(var15.length() == 0);

            com.aspose.cells.a.d.zf var2;
            com.aspose.cells.a.d.zav var3;
            float var5;
            if (this.j) {
               var5 = Math.max(0.1F, this.c(var12.a.b.getDoubleSize(), this.n));
               if (var12.a.b.isSubscript() || var12.a.b.isSuperscript()) {
                  var5 *= b;
               }

               var3 = com.aspose.cells.a.d.zav.a(var12.a.b.getName(), var5, var13);
               var14 = this.e - this.m.a() - (var12.b + var12.c) - (float)var9 * var8.h - 1.0F;
               var2 = new com.aspose.cells.a.d.zf(var3, var4, new com.aspose.cells.b.a.b.zo(var14, var8.b - var8.f), var15, var12.a.b.isSuperscript(), var12.a.b.isSubscript());
            } else {
               var14 = var8.e + var12.b;
               if (this.h != 3 && this.h != 6 && this.h != 8) {
                  var5 = Math.max(0.1F, this.c(var12.a.b.getDoubleSize(), this.n));
                  if (var12.a.b.isSubscript() || var12.a.b.isSuperscript()) {
                     var5 *= b;
                  }

                  var3 = com.aspose.cells.a.d.zav.a(var12.a.b.getName(), var5, var13);
                  var2 = new com.aspose.cells.a.d.zf(var3, var4, new com.aspose.cells.b.a.b.zo(var10 + var6, var8.b - var8.f), var15, var12.a.b.isSuperscript(), var12.a.b.isSubscript());
                  var10 += var12.c;
                  var2.a(var10 + var6);
               } else {
                  var5 = Math.max(0.1F, this.c(var12.a.b.getDoubleSize(), this.n));
                  if (var12.a.b.isSubscript() || var12.a.b.isSuperscript()) {
                     var5 *= b;
                  }

                  var3 = com.aspose.cells.a.d.zav.a(var12.a.b.getName(), var5, var13);
                  var2 = new com.aspose.cells.a.d.zf(var3, var4, new com.aspose.cells.b.a.b.zo(var14 + (float)var9 * var8.h + var6, var8.b - var8.f), var15, var12.a.b.isSuperscript(), var12.a.b.isSubscript());
               }
            }

            var2.c = var12.a.b.getUnderline();
            if (var12.a.d != 4) {
               var2.b(var8.d);
               var1.a((com.aspose.cells.a.d.zl)var2);
            }

            ++var9;
         }
      }

   }
}
